package com.example.myapplication;

import com.example.myapplication.db.User;
import com.speedystone.greendaodemo.db.DaoSession;
import com.speedystone.greendaodemo.db.UserDao;

import java.util.List;

/**
 * Created by Lx on 2018/8/13.
 */

public class RecordUtils {

    //从后到前的分页查询,是否还有数据的标志,默认是还有数据
    static boolean isMoreRecord = true;
    private static UserDao userDao;


//    //下标
//    int index = this.getContent() - 10;


    RecordUtils() {
        DaoSession daoSession = MyApp.getDaoSession();
        userDao = daoSession.getUserDao();
    }

    private static class UtilsHolder {
        private static final RecordUtils utils = new RecordUtils();
    }

    static RecordUtils getInstance() {

        return RecordUtils.UtilsHolder.utils;
    }


    List<User> getHolder(int page) {
        //每次显示的数量
        int limit = 10;
        //获取总数
        int content = userDao.queryBuilder().where(UserDao.Properties.Age.eq(10)).list().size();
        //分页总数
        int number = content / 10;
        if (content % 10 > 0) {
            number = number+1;
        }


        return null;

    }

    //获取页数
    private int getNumber() {

        return 0;
    }


}